#!/bin/bash

if [[ $# -ne 1 ]];then
	printf "********************************\n"
	printf "* Usage: mygit gitee_repo_name *\n"
	printf "* Example: mygit A-Tune        *\n"
	printf "********************************\n"
	exit 1
fi

printf "1: src-openeuler\n2: openeuler\n3: wangchong1995924\n4: hopeOS\nq: quit\n"

for ((i=0;i<=4;i++))
do
	read -p "Please choose:" res
	if [[ ${res} == "1" ]];then
		res="src-openeuler"
		break
	elif [[ ${res} == "2" ]];then
		res="openeuler"
		break
	elif [[ ${res} == "3" ]];then
		res="wangchong1995924"
		break
	elif [[ ${res} == "4" ]];then
		res="hopeOS"
		break
	elif [[ ${res} == "q" ]];then
		exit 0
	else
		if [ $i -lt 4 ];then
			printf "Input error, Please input again.\n"
		else
			printf "Too many wrong choices, the program auto quit !\n"
			exit 0
		fi
	fi
done
git clone --depth=1 https://gitee.com/${res}/$1.git `pwd`/$1
